package com.xintonghua.bussiness.ui.view;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.umeng.socialize.bean.SHARE_MEDIA;
import com.xintonghua.bussiness.R;

import razerdp.basepopup.BasePopupWindow;


/**
 * 订单取消的时候弹出的dialog
 */
public class PopupShare extends BasePopupWindow {
    private Context context;
    private TextView text;
    private LinearLayout wx_pyq;
    private LinearLayout ll_wx;
    private LinearLayout ll_qq;
    private LinearLayout ll_qzone;

    private MyClickListener myClickListener;
    private boolean mini = false;

    public PopupShare(Context context) {
        super(context);
        this.context = context;
        initView();
    }

    public PopupShare(Context context,Boolean mini) {
        super(context);
        this.context = context;
        this.mini=mini;
        initView();
    }


    @Override
    protected Animation initShowAnimation() {
        return null;
    }

    @Override
    public View getClickToDismissView() {
        return getPopupWindowView();
    }

    private void initView() {
        wx_pyq = (LinearLayout) findViewById(R.id.ll_wx_pyq);
        ll_wx = (LinearLayout) findViewById(R.id.ll_wx);
        ll_qq = (LinearLayout) findViewById(R.id.ll_qq);
        ll_qzone = (LinearLayout) findViewById(R.id.ll_qzone);

        wx_pyq.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myClickListener.share(SHARE_MEDIA.WEIXIN_CIRCLE);
                dismiss();
            }
        });

        ll_wx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myClickListener.share(SHARE_MEDIA.WEIXIN);
                dismiss();
            }
        });

        ll_qq.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myClickListener.share(SHARE_MEDIA.QQ);
                dismiss();
            }
        });

        ll_qzone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myClickListener.share(SHARE_MEDIA.QZONE);
                dismiss();
            }
        });

    }

    @Override
    public View onCreatePopupView() {
        return createPopupById(R.layout.popup_share);
    }

    @Override
    public View initAnimaView() {
        return null;
    }

    public interface MyClickListener {
        void share(SHARE_MEDIA type);
    }

    public void setMyClickListener(MyClickListener myClickListener) {
        this.myClickListener = myClickListener;
    }

}
